/*
 * inotify-sync - a simple file synchronizer and file system watcher
 * Copyright (C) 2010-2011, inotify-sync developers and inotify-sync contributors
 * Copyright (C) 2010-2011, Cohesion Network Security Studio
 *
 * inotify-sync is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * inotify-sync is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with inotify-sync; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/*
 * FILE:			Error.h
 * USAGE:			---
 * DESCRIPTION:		---
 * OPTIONS:			---
 * REQUIREMENTS:	---
 * BUGS:			---
 * NOTES:			---
 * AUTHOR:			LI Yiwei (mail:leeyiw@gmail.com)
 * COMPANY:			---
 * VERSION:			1.0
 * CREATED:			Thu Oct 20 18:09:57 CST 2011
 * REVISION:		---
 */


#ifndef ERROR
#define ERROR

#include <inttypes.h>
#include <string>
#include <string.h>
#include <stdio.h>
#include <errno.h>

#define E_NOTHINGERROR		0
#define E_UNKNOWNERROR		1
#define E_CONFNOTEXIST		2
#define E_CONFPERMDENY		3
#define E_PROFPERMDENY		4
#define E_PROFCREATERR		5
#define E_LOGFPERMDENY		6
#define E_LOGFCREATERR		7
#define E_PROFNOTEXIST		8
#define E_INOTINITFAIL		9
#define E_INITOFRWLOCK		10
#define E_GETWRLOCKERR		11
#define E_GETUNLOCKERR		12
#define E_DESTOFRWLOCK		13
#define E_CREATETHREAD		14
#define E_JOINTHREADER		15
#define E_CONFFOPENERR		16

using namespace std;

class Error
{
public:
	Error(int errnum,uint32_t error_id);
	virtual ~Error();

	uint32_t get_error_id();
	string get_error_info();
	string get_error_detail();
	void print_error_info();
	void print_error_detail();
	void print_error();
protected:
private:
	uint32_t error_id;
	int errnum;
};

#endif
